<?php
/*
Template Name: 3. ShopperPress Contact Page
*/


$wpdb->hide_errors(); nocache_headers();
 
if(isset($_POST['do']) && $_POST['do'] == "run"){

		check_admin_referer('ShopperPressContactForm');

		$subject = "SHOPPERPRESS CONTACT FORM"; 
		$message = "\r\n ========== Contact Form Details ========== \r\n\r\n";
		$message .= SPEC($GLOBALS['_LANG']['_c3'])." : " . strip_tags($_POST['contact_name']) . "
					\r\n ".SPEC($GLOBALS['_LANG']['_c5'])." : " . strip_tags($_POST['contact_email']) . "
					\r\n ".SPEC($GLOBALS['_LANG']['_c4'])." : " . strip_tags($_POST['contact_phone']) . "
					\r\n ".SPEC($GLOBALS['_LANG']['_c7'])." : " . strip_tags($_POST['LookingFor']) . "
					\r\n ".SPEC($GLOBALS['_LANG']['_c12'])." : " . strip_tags($_POST['contact_aboutus']) . "
					\r\n ".SPEC($GLOBALS['_LANG']['_c6'])." : " . strip_tags($_POST['contact_country']) . "
					\r\n Notes : " . strip_tags($_POST['contact_comment']) . "";
					
		shopperpress_sendmail(get_option("shipping_email"), $subject, $message);

 		 
		$completed =1;
}


get_header(); 

?>

<?php if(isset($completed)){ ?>

<h2 class="h2top"><?php echo SPEC($GLOBALS['_LANG']['_c16']) ?></h2>
<p><?php echo SPEC($GLOBALS['_LANG']['_c17']) ?></p>
<p><?php echo SPEC($GLOBALS['_LANG']['_c18']) ?></p>

<?php }else{ ?>

		
 
<h2 class="h2top"><?php echo SPEC($GLOBALS['_LANG']['_c1']) ?></h2>
				

<p style="font-size:14px; line-height:30px;"><?php echo SPEC($GLOBALS['_LANG']['_c2']) ?></p>
<br />
 
<style>
form div{clear:none;margin-bottom:0;vertical-align:text-top;padding:0;}
#form{padding:10px; width:580px; margin-bottom:30px;  }
#form1{width:280px; float:left; display:inline;}
#form2{margin-left:20px; width:280px; float:left; display:inline;}
#form p{color:#333333; font-size:14px;}
.enq_form{background-color:#eee; border: 2px solid #cccccc; font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666666; padding:5px; margin-top:5px; width:260px}
.send_button{width:107px; height:29px; background: #666666; border:0; color:white; cursor:pointer; margin-top:30px; font-weight:bold; font-family: Arial, Helvetica, sans-serif; }
</style>


	<script>

		function CheckCallBackForm()
		{
 
			var phone = document.getElementById("phone"); 
			var comment = document.getElementById("comment1");

			if(phone.value == '')
			{
				alert('Please enter your phone number.');
				phone.focus();
				return false;
			}
 
			if(comment.value == '')
			{
				alert('Please enter your question/comment.');
				comment.focus();
				return false;
			}

			// Everything is OK
			return true;
		}

	</script>
<form  action="" method="post" id="frmContact" name="frmContact" onSubmit="return CheckCallBackForm()">
<?php wp_nonce_field('ShopperPressContactForm') ?>
<input type="hidden" name="do" value="run">

<div id="form">

	<div id="form1"> 
		<p><strong><?php echo SPEC($GLOBALS['_LANG']['_c3']) ?>:</strong> *<br /><input type="text" id="name" name="contact_name" class="enq_form" /></p>
		<p><strong><?php echo SPEC($GLOBALS['_LANG']['_c4']) ?>:</strong> *<br />  <input type="text" id="phone" name="contact_phone" class="enq_form" /></p>
		<p><strong><?php echo SPEC($GLOBALS['_LANG']['_c5']) ?>:</strong> *<br />   <input type="text" name="contact_email" id="email" class="enq_form" /></p>
		<p><strong><?php echo SPEC($GLOBALS['_LANG']['_c6']) ?>:</strong> *<br />   <input type="text" id="country" name="contact_country" class="enq_form" /></p>

	</div>
	
	<div id="form2">
	<p><strong><?php echo SPEC($GLOBALS['_LANG']['_c11']) ?></strong><br />  <textarea id="comment1" name="contact_comment" cols="30" rows="6" class="enq_form"></textarea></p>
 	<p><strong><?php echo SPEC($GLOBALS['_LANG']['_c7']) ?>:</strong><br />
		<input name="LookingFor" type="radio" value="<?php echo SPEC($GLOBALS['_LANG']['_c8']) ?>" checked> <?php echo SPEC($GLOBALS['_LANG']['_c8']) ?> <br /><div class="clear"></div>
		<input type="radio" name="LookingFor" value="<?php echo SPEC($GLOBALS['_LANG']['_c9']) ?>"> <?php echo SPEC($GLOBALS['_LANG']['_c9']) ?> <br /><div class="clear"></div>
		<input type="radio" name="LookingFor" value="<?php echo SPEC($GLOBALS['_LANG']['_c10']) ?>"> <?php echo SPEC($GLOBALS['_LANG']['_c10']) ?>
	</p>
	<input class="send_button" type="submit" value="<?php echo SPEC($GLOBALS['_LANG']['_c15']) ?>" name=""/>
	
	</div><div class="clearfix"></div>

</div></form>

<br />
<br />

 
<?php } ?> 

<?php get_footer(); ?>